<form action="index.php?<{$env.server.QUERY_STRING}>" method="post">
  <div class="tableform">
    <input type=hidden name='member_id' value=<{$mem.member_id}>>
    <div class="division" style="border:none;">
      <table class="forform" width="100%" border="0" cellspacing="0" cellpadding="0">

        <!-- add by 黄智坤  2017-3-20 =====-->
        <!-- =====-add by 黄智坤  2017-3-20 -->
        <tr>
          <th><{t}>用户名<{/t}></th>
          <td> <{$mem.account.local}></td>
          <th><{t}>法人姓名<{/t}></th>
          <td> <{input type='text' name='frname' value=$mem.members.frname}>  </td>
          <th><{t}>公司名<{/t}></th>
          <td> <{input type='text' name='gcname' value=$mem.members.gcname}>  </td>
          <th><{t}>法人身份证号<{/t}></th>
          <td> <{input type='text' name='idnumber' value=$mem.members.idnumber}>  </td>
        </tr>
        
        <tr>
          <th><{t}>邮箱<{/t}></th>
          <td><{$mem.account.email}></td>
           <th><{t}>手机号码<{/t}></th>
          <td><{$mem.account.mobile}></td>
         	 
           <!-- <th><{t}>u8客户编码<{/t}></th> -->
          <!-- <td><{input type='text' name='u8code'   value=$mem.members.u8code}></td> -->
		   <th><{t}>推荐业务员<{/t}></th>
          <td> <{input type='text' name='salesman' value=$mem.members.salesman}>  </td>
        </tr>
	
        <tr>
         
          <th><{t}>渠道商等级<{/t}></th>
          <td> <{input type='select' name='member_lv[member_group_id]' options=$mem.lv.options required=true value=$mem.lv.value }>  <span onclick="new Dialog('index.php?app=b2c&ctl=admin_member&act=chkpassword&p[0]=<{$member_id}>',{width:400,height:300,title:'<{t}>修改密码<{/t}>'})" class="lnk">[<{t}>修改密码<{/t}>]</span> </td>
       	  <th><{t}>办事处选择<{/t}></th>
          <td> <{input type='select' name='office_id' options=$mem.office_id.options required=false value=$mem.members.office_id}>  </td>
       	  <!-- <th><{t}>是否月结客户<{/t}></th> -->
       	  <!-- <td>
       	  <select name="monthpay">
	      <option <{if $mem.members['monthpay'] == '1'}> selected <{/if}> value="1">是</option>
	      <option <{if $mem.members['monthpay'] == '0'}> selected <{/if}> value="0">否</option>
	    </select>  
         </td> -->
           <!--<th><{t}>联系电话<{/t}></th>
          <td><{input type='text' name='contact[phone][telephone]' required=true value=$mem.members.tel}></td> 
          -->
       	 </tr>

       
        <tr>
         <th><{t}>食品流通许可证<{/t}></th>
          <td> <{input type='image' name='permit'  required=true value=$mem.members.permit}>  </td>
         <th><{t}>点击查看许可证<{/t}></th>
          <td> <{$mem.img_src_permit}>  </td>
           <th><{t}>营业执照图片<{/t}></th>
          <td> <{input type='image' name='licensep'  required=true value=$mem.members.licensep}>  </td>
           <th><{t}>点击查看营业执照<{/t}></th>
          <td> <{$mem.img_src_licensep}>  </td>
        
       </tr>  
        <!-- add by 黄智坤  2017-3-27 =====-->
        <!-- =====-add by 黄智坤  2017-3-27 -->

        <{foreach from=$attr item=item name="item" key='row'}>
        <tr>
          <th><{if $item.attr_required eq 'true'}><em>*</em><{/if}><{$item.attr_name|t:'b2c'}></th>
         <td>  

            <{if $item.attr_type =='date'}> 
            <{if $item.attr_value != '0-0-0' && $item.attr_value != '--'}>
            <{if $item.attr_required eq 'true'}>
            <{input class="cal" type='date' vtype="required&&date" name=$item.attr_column value=$item.attr_value}>
            <{else}>
            <{input class="cal" type='date' name=$item.attr_column value=$item.attr_value}>
            <{/if}>
            <{else}>
            <{if $item.attr_required eq 'true'}>
            <{input class="cal" type="date" vtype="required&&date" name=$item.attr_column}>
            <{else}>
            <{input class="cal" type="date" name=$item.attr_column}>
            <{/if}>
            <{/if}>
            <{/if}>

            <{if $item.attr_type =='region'}>
            <{if $item.attr_required eq 'true'}>
            <{input app=ectools type="region" name=$item.attr_column value=$item.attr_value vtype="area" }>
            <{else}>
            <{input app=ectools type="region" name=$item.attr_column value=$item.attr_value vtype="" }>
            <{/if}>
            <{/if}>

            <{if $item.attr_type =='gender'}>
            <{input type='gender' name=$item.attr_column value=$item.attr_value }>
            <{/if}>

            <{if $item.attr_type =='select'}>
            <select name='<{$item.attr_column}>' <{if $item.attr_required eq 'true'}>class='_x_ipt' vtype='required'<{/if}>>
              <option value='' <{if $item.attr_value == ''}>selected='true'<{/if}>><{t}>请选择<{/t}></option>
              <{foreach from=$item.attr_option item=option name="option"}>
              <option value='<{$option}>' <{if $item.attr_value == $option}>selected='true'<{/if}>><{$option}></option>
              <{/foreach}>

            </select>
            <{/if}>

            <{if $item.attr_type =='checkbox'}>
            <{foreach from=$item.attr_option item=checkbox name="checkbox" }>



            <input type='checkbox' name=box:<{$item.attr_column}>[]" value='<{$checkbox}>' <{foreach from=$item.attr_value item=checkboxvalue name="checkboxvalue" }>
            <{if $checkboxvalue==$checkbox}>
            checked ='true' />
            <{/if}>
            <{/foreach}>><label><{$checkbox}></label><br/>
            <{/foreach}><input type='hidden' name='<{$item.attr_column}>[]' value='%no%'>

            <{if $item.attr_required eq 'true'}><input type='hidden' class='_x_ipt' vtype='selectc'/>
            <{/if}>
            <{/if}>


            <{if $item.attr_type == 'text'}>
            <input type='text' name=<{$item.attr_column}> value='<{$item.attr_value}>' vtype='<{if $item.attr_required eq 'false'}>required&&<{/if}><{$item.attr_valtype}>' />
            <{/if}>

            <{if $item.attr_type == 'number'}>
            <input type='text' name=<{$item.attr_column}> value='<{$item.attr_value}>' vtype='<{if $item.attr_required eq 'false'}>required&&<{/if}><{$item.attr_valtype}>' />
            <{/if}>

            <{if $item.attr_type == 'alpha'}>
            <input type='text' name=<{$item.attr_column}> value='<{$item.attr_value}>' vtype='<{if $item.attr_required eq 'false'}>required&&<{/if}><{$item.attr_valtype}>' />
            <{/if}>

          </td>
        </tr>
        <{/foreach}>  
        <tr>
          <th></th>

        </tr>
		
      </table>
    </div>
    <div class="table-action"><{button type="submit" label=$___b2c="保存"|t:'b2c' }></div>
  </div>
</form>

<script>
  (function(){
    var input = $(document.body).getElements('input[name=contact[area]]')[0];
    var select = input.getNext('select');
    if(input.getParent('span').get('vtype') == 'area') {
      return;
    }
    select.addEvent('change',function(e){
      if(!e.target) return;
      if($(e.target).value !='_NULL_'){
        input.getParent('span').set('vtype','area');
      }
      else{
        input.getParent('span').set('vtype','');
      }
    });
  })();
</script>
